//
//  HMStatusViewModel.swift
//  VVeibo21
//
//  Created by apple on 2016/10/27.
//  Copyright © 2016年 Apple. All rights reserved.
//

import UIKit

// MARK: - 处理微博用户等级 -

class HMStatusViewModel: NSObject {

    var statusModel:HMStatusModel?{
        
        didSet{
            
            mbrankImage = dealMbrankImage(mbrank: statusModel?.user?.mbrank ?? 0)
            verifiedImage = dealVerifiedImage(Verified: statusModel?.user?.verified ?? -1)
        }
    }
    
    var mbrankImage:UIImage?
    var verifiedImage:UIImage?
}

extension HMStatusViewModel{
    
    func dealVerifiedImage(Verified:Int)->UIImage?{
        
        switch  Verified{
        case 1:
            return UIImage(named:"avatar_vip")
        case 2,3,5:
            return UIImage(named:"avatar_enterprise_vip")
        case 220:
            return UIImage(named:"avatar_grassroot")
        default:
            return UIImage(named:"avatar_vgirl")
        }
    }
}

extension HMStatusViewModel{
    
    func dealMbrankImage(mbrank:Int)->UIImage?{
        
        print("🌹🌹come in 🌹🌹")
        
        if mbrank > 0 && mbrank < 7 {
            return UIImage(named:"common_icon_membership_level\(mbrank)")
        }else{
            return UIImage(named:"common_icon_membership")
        }
        
    }
}
